var Model = new Class({
    	
/*	Construct a new model
			data: Object to add (json decoded) */
			
	initialize: function(data)
	{
		this.stringType = 'baseModel';
		for(var property in data)
		{
			if( $defined(data[property]) && (data[property]!= undefined) )
				this.baseEdit(property, data[property]);
		}			
	},
		
/* Edit a propery on this model,  	
			prop : name of property to change
			value : what to assign this property */
			
	baseEdit: function(prop, value)
		{
			eval("this." + prop + " = '" + value + "';");
		},
		
/*	Assign users to this project. 
		items : string seperated list of user id's to assign to this project */
		
	baseAssignUsers: function( items )
		{
			if($type(items == 'string'))
			{
				items = items.trim();
				var i = items.split(' ');
				this.userCount = i.length;
				this.users = items;
			}
		},	
		
	baseAssignGroups: function( items )
		{
			if($type(items == 'string'))
			{
				items = items.trim();
				var i = items.split(' ');
				this.groupCount = i.length;
				this.groups = items;
			}
		},		
		
/* Returns a string version of this object for debug rendering. */
	toStr: function()
	{
		//Trick to get only the values we assigned, encode to json and decode and use that to iterate.
		var data = down(this);
		data = up(data);
		
		var str = '<div style="margin:20px; padding:10px; border:solid 1px #000;"><b>' + this.stringType + ' :: '+ this.name + ' </b><br /><br />';
		str += '<div style="margin-left:30px;">';
		for(var property in data)
		{
			if( $defined(data[property]) && (data[property]!= undefined) )
			{
				if(property != 'stringType' && property != 'name')
					str += '<b>' + property + '</b> : ' + data[property] + '<br />';
			}
		}
		
		str += '<br /></div></div>';
		return str;
	}
		
});